package Game;

import java.awt.Rectangle;
import java.util.ArrayList;

public class Dude extends Entity{
	int bullets;
	static double health=100;
	static int ammo=10;

	public Dude(Sprite sprite,int ID, int x, int y) {
		super(sprite,ID,x, y);
		exists=true;
	}
	public double getHealth(){
		return health;
	}
	public int getAmmo(){
		return ammo;
	}
	/**
	 * modififer true = plus.
	 * modififer false = minus.
	 * health is how much health you remove or add.
	 * 
	 * @param modififer
	 * @param health
	 */
	public void doHealth(boolean modififer,double health){
		if(modififer){
			this.health+=health;
		}
		if(!modififer){
			this.health-=health;
		}
	}
	public void setHealth(double health){
		this.health=health;
	}
	public void setCollision(boolean collision){
		this.collision=collision;
	}
	public void fire(ArrayList<Projectile> projectiles,Sprite sprite,int x,int y){
		if(ammo>0){
			ammo--;
			Projectile bullet=new Projectile(sprite,projectiles.size(),x+5,y+5){};
			if((Mainth.lastpressedx==1&&Mainth.lastpressedxy==1)||Mainth.left)
				bullet.setHorMove(-1);
			if((Mainth.lastpressedx==2&&Mainth.lastpressedxy==1)||Mainth.right){
				bullet.setHorMove(1);
			}
			if((Mainth.lastpressedy==1&&Mainth.lastpressedxy==2)||Mainth.up){
				bullet.setVerMove(-1);
			}
			if((Mainth.lastpressedy==2&&Mainth.lastpressedxy==2)||Mainth.down){
				bullet.setVerMove(1);
			}
			projectiles.add(bullet);
		}
	}
	boolean left,right,up,down;
	public Rectangle getmeXL(){
		Rectangle meXL=new Rectangle(getX()-1,getY(),1,sprite.getHeight());
		return meXL;
	}

}
